<template>
    <div>
        <el-form-item  v-for="(item,index) in imglist" :key="index">
            <el-input v-model="imglist[index]" ></el-input>

            <el-button type="primary" @click="changeImg(index)">选择图片</el-button>
        </el-form-item>
        <el-button type="primary">确定</el-button>
        <change-image ref="changeimg" imgnum="1" albumType="store" @returnPicture="getPicture"></change-image>
    </div>
</template>

<script>
	import changeImage from '../../components/changeImage';

	export default {
		name: "qkCarouselAttr",
        props: {
			prop:{
              type:Array,
              default(){
                return []
              }
            }
        },
      components:{
	      changeImage
      },
      data(){
        return {
            imglist:[],
          idx:0
        }
      },
      methods:{
	      changeImg(index){
	      	this.idx = index;
	      	this.$refs.changeimg.open();
          },
	      getPicture(url){
	      	console.log(url)
            this.$nextTick(()=>{
	            this.imglist[this.idx] = url;
	            this.prop = this.imglist
            })
			this.$store.commit("updateActiveElementProp",this.imglist);
          }
      },
      mounted(){
	      this.imglist = this.prop
      },
      watch:{
		'imglist'(e){
			this.imglist = e
        }
      }
	}
</script>

<style scoped>

</style>